package net.ojbk.timeSpace.timeAxis.web.handlers;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import net.ojbk.timeSpace.timeAxis.beans.User;
import net.ojbk.timeSpace.timeAxis.common.sso.InfoClient;
import net.ojbk.timeSpace.timeAxis.common.sso.InfoSso;

@Controller
@RequestMapping("/user")
public class UserController {
	
	@RequestMapping("/login.do")
	public ModelAndView doLogin(String jumpAdd, HttpSession session) {
		ModelAndView mv = new ModelAndView();
		User user = (User) session.getAttribute("user");
		if (user == null)
		{
			session.setAttribute("jumpAdd", jumpAdd);
			mv.addObject(InfoSso.centerLoginUrlParName1, InfoClient.clientKey);
			mv.setViewName("redirect:" + InfoSso.centerLoginUrl);
			return mv;
		}
		mv.setViewName("redirect:" + jumpAdd);
		return mv;
	}
}
